package com.mine.common.core.table;


import com.mine.common.core.request.dto.RealmVO;

import javax.swing.table.AbstractTableModel;
import java.util.List;

/**
 * 境界表模型
 *
 * @author WangYX
 * @version 1.0.0
 * @date 2023/11/30 10:00
 */
public class RealmTableModel extends AbstractTableModel {

    /**
     * 列名
     */
    private final String[] columns = {"id", "修行路线名称", "名称", "操作"};


    /**
     * 单元格数据
     */
    private List<RealmVO> list;

    @Override
    public int getRowCount() {
        return list.size();
    }

    @Override
    public int getColumnCount() {
        return columns.length;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        RealmVO vo = list.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return vo.getId();
            case 1:
                return vo.getCategoryName();
            case 2:
                return vo.getName();
            default:
                return "";
        }
    }

    @Override
    public String getColumnName(int column) {
        return columns[column];
    }


    public String[] getColumns() {
        return columns;
    }

    public List<RealmVO> getList() {
        return list;
    }

    public void setList(List<RealmVO> list) {
        this.list = list;
    }
}
